    <p>filter &nbsp level:<input type="text" id="test_level" style="width:50px" />
	id:<input type="text" id="test_id" style="width:50px" />
	remember:<input type="text" id="test_remember" value='0' style="width:50px" />
	remain:<label id='test_remembered'></label>
	</p>
	<input type="button" value="next" onclick="testGet();" />
	<input type="button" value="tip" onclick="testShowTip();" />
	<input type="button" value="remember" onclick="test_remember();" />
	<input type="button" value="forgive" onclick="test_forget();" />
	<div style="font-size:50px" id="test_showWord"><div>
	<div style="font-size:20px" id="test_showWord"><div>

<script>

function testGet(){
	var id = $("#test_id").val();
	var level = $("#test_level").val();
	var remember = $("#test_remember").val();
	if (!level)
		level = 0;
	if (!id)
		id = 0;
	client.query('select * from words where id>? and level=? and remembered=? order by id limit 1',[id,level,remember],function(err, results){
		if(results.length >0){
			$("#test_showWord").html(results[0].word);
			$("#test_id").val(results[0].id);
			$("#test_level").val(results[0].level);
		}else{
			layer.msg("no more words");
		}
	});
	
	client.query('select count(*) as res from words where id>? and level=? and remembered=? ',[id,level,remember],function(err, results){
		if( results.length >0 ){
			$("#test_remembered").html(results[0].res);
		}
	});
}
function test_updateWord(val,id){
	client.query('update words SET remembered=? where id=? ',[val,id],function(err1, results1){
		if(results1.affectedRows==1){
			layer.msg("update success");
		}
	});
}
function test_remember(){
	var id = $("#test_id").val();
	if (id){
		test_updateWord(1,id);
	}
}
function test_forget(){
	var id = $("#test_id").val();
	if (id){
		test_updateWord(0,id);
	}
}
function testShowTip(){
	layer.open({
	  type: 2,
	  title: '',
	  shadeClose: true,
	  shade: 0.8,
	  area: ['728px', '500px'],
	  content: 'http://dict.youdao.com/search?q='+$("#test_showWord").html()
	}); 
}


</script>